public class Tetrahedro{
  
  private float x,y,z,altura,ancho;
  private Sphere s1,s2,s3,s4;
  private ArrayList restriccion;
  
 public Tetrahedro(float x, float y, float z,float altura,float ancho,boolean pinned){
  this.x=x;
  this.y=y;
  this.z=z;
  this.altura=altura;
  this.ancho=ancho;
  
  s1 = new Sphere(5, new PVector(x,y,z),new PVector(0,0,0),pinned);
  s2 = new Sphere(5, new PVector(x+ancho/2,y,z),new PVector(0,0,0),pinned);
  s3 = new Sphere(5, new PVector(x-ancho/2,y,z),new PVector(0,0,0),pinned);
  s4 = new Sphere(5, new PVector(x,y+altura,z),new PVector(0,0,0),pinned);
  restriccion = new ArrayList();
  restriccion.add(new Stick(s1,s2,true));
  restriccion.add(new Stick(s2,s3,true));
  restriccion.add(new Stick(s3,s1,true));
  restriccion.add(new Stick(s1,s4,true));
  restriccion.add(new Stick(s2,s4,true));
  restriccion.add(new Stick(s3,s4,true));
  
 }
 
 public void setGravedad(PVector g){
   s1.setAcc(g);
   s2.setAcc(g);
   s3.setAcc(g);
   s4.setAcc(g);
 }
 public void actualizar(){
  s1.actualizar(1);
  s2.actualizar(1);
  s3.actualizar(1);
  s4.actualizar(1);
  
 }
 public void draw(){
    s1.draw();
    s2.draw();
    s3.draw();
    s4.draw();
 }
 public void aplicar(){
  Iterator i = restriccion.iterator();
 while(i.hasNext()){
  Stick s = (Stick) i.next();
  s.apply();
 } 
 }

  
 
}
